-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(google-vault): error handling improvement and more params #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Adds specialized error handling for Google Vault credential expiration issues by creating a dedicated block handler that detects RAPT and invalid_grant errors, providing users with actionable reconnection instructions. Extends Google Vault functionality with date filtering (startTime, endTime) and search terms for both exports and holds, plus shared drive support for DRIVE corpus holds. Removes the unused timeZone parameter from export operations.
Confidence Score: 3/5
- Generally safe to merge with minor validation concerns
- The PR improves error handling and adds useful functionality, but has duplicate field IDs in the block configuration that could cause form rendering issues. The query object construction in create_matters_holds.ts should be verified to ensure empty query objects are handled correctly by the Google Vault API. The error handling logic itself is well-implemented with comprehensive pattern matching.
- apps/sim/blocks/blocks/google_vault.ts needs duplicate field ID resolution; apps/sim/tools/google_vault/create_matters_holds.ts needs API validation for empty query objects
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/executor/handlers/google-vault/google-vault-handler.ts | 4/5 | Adds specialized handler for Google Vault blocks with enhanced credential error detection and user-friendly error messages |
| apps/sim/tools/google_vault/create_matters_holds.ts | 3/5 | Adds query parameters for MAIL/GROUPS date filtering and DRIVE shared drive support; query object construction needs validation |
| apps/sim/blocks/blocks/google_vault.ts | 3/5 | Adds extensive UI configuration for date filtering and search terms with wand AI prompts; duplicate field IDs need attention |
Sequence Diagram
sequenceDiagram
participant Client
participant GoogleVaultHandler
participant executeTool
participant GoogleVaultAPI
Client->>GoogleVaultHandler: execute(block, inputs)
GoogleVaultHandler->>GoogleVaultHandler: Transform inputs & parse JSON
GoogleVaultHandler->>executeTool: Execute with credentials
executeTool->>GoogleVaultAPI: API Request
alt Success
GoogleVaultAPI-->>executeTool: Valid response
executeTool-->>GoogleVaultHandler: result.success = true
GoogleVaultHandler-->>Client: Return output
else Credential Error
GoogleVaultAPI-->>executeTool: invalid_grant/RAPT error
executeTool-->>GoogleVaultHandler: result.success = false
GoogleVaultHandler->>GoogleVaultHandler: isCredentialRefreshError()
GoogleVaultHandler->>GoogleVaultHandler: enhanceCredentialError()
GoogleVaultHandler-->>Client: User-friendly error with reconnection guidance
else Other Error
GoogleVaultAPI-->>executeTool: Other error
executeTool-->>GoogleVaultHandler: Throws error
GoogleVaultHandler->>GoogleVaultHandler: Check if credential error
GoogleVaultHandler-->>Client: Enhanced or standard error message
end
apps/sim/executor/handlers/google-vault/google-vault-handler.ts
Outdated
Show resolved
Hide resolved
3979d09 to
ec75de3
Compare
Greptile SummaryThis PR improves Google Vault integration by adding comprehensive error handling for authentication issues and new date/search filtering parameters. Key changes:
Implementation notes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Block as Google Vault Block
participant Tool as Tool Config
participant API as Google Vault API
participant Utils as Error Utils
User->>Block: Create export/hold with date filters
Block->>Block: Map UI fields (holdStartTime → startTime)
Block->>Tool: Execute with mapped parameters
Tool->>Tool: Build request body with query filters
Tool->>API: POST /matters/{matterId}/exports or /holds
alt Success
API-->>Tool: 200 OK with export/hold data
Tool-->>Block: Return success output
Block-->>User: Display result
else Authentication Error (RAPT/invalid_grant)
API-->>Tool: 401/403 with error message
Tool->>Utils: enhanceGoogleVaultError(errorMessage)
Utils->>Utils: Detect RAPT/token refresh patterns
Utils-->>Tool: Enhanced error with remediation steps
Tool-->>Block: Throw enhanced error
Block-->>User: Show actionable error message
else Other API Error
API-->>Tool: Error response
Tool->>Utils: enhanceGoogleVaultError(errorMessage)
Utils-->>Tool: Return original message
Tool-->>Block: Throw error
Block-->>User: Show error message
end
|
Summary
Added better error handling for vault specifically. Google Cloud by default has a limit for token expiration, and they throw invalid_grant after the token expires, and the only workaround to this is disconneting and reconnecting credential, or, as an admin, disabling reauth for Sim.
Also added additional params for dates
Type of Change
Testing
Tested manually
Checklist